<link rel="stylesheet" type="text/css" href="<?php echo BASEURL.'css/isi.css' ?>">

<?php 
require_once '../kelas/record.php';
require_once '../kelas/amankanParam.php';
require_once '../kelas/fungsi.php';
require_once '../kelas/pemesanan.php';
require_once '../kelas/siteoptions.php';
require_once '../kelas/kategori.php';

require_once '../kelas/produk.php';
$mStok = $objProduk->getMinimStok();
$objFungsi = new fungsi();
$dtPesanan = $objPemesanan->getPendingOrder();
echo $objFungsi->buatJudul('Selamat datang, '.$_SESSION['adminlogin']['nama'],113);
//$objFungsi->var_dump($mStok,false);
 ?>
 <h3>Daftar Pesanan Baru:</h3>
 <hr />
 <?php if (count($dtPesanan)==0): ?>
 	<p align="center">(tidak ada pesanan baru)</p>
 <?php else: ?>
 	<div class="frame_table_order">
<table width="100%" cellpadding="5" cellspacing="0" border="1" style="border-collapse:collapse">

    <thead>
        <tr align="center" valign="middle" bgcolor="#CCCCCC">
        		<td>Tanggal</td>
 			<td>Nama Pemesan</td>
 			<td>Pesan Tambahan</td>
 			<td>Subtotal</td>
 			<td>Kota Tujuan</td>
 			<td>Biaya Pengiriman</td>
 			<td>Total</td>
 			<td>Pilihan</td>
 		</tr>
 	</thead>
 		<?php foreach ($dtPesanan as $dtPsn): ?>
 			
 		<tr class="font_isi_judul" align="center" valign="middle">
 			<td><?php echo $objFungsi->tanggal1($dtPsn['tanggal']); ?></td>
 			<td><?php echo $dtPsn['nama_pemesan'] ?></td>
 			<td><?php echo $objFungsi->readMore($dtPsn['pesan_tambahan']); ?></td>
 			<td><?php echo $objFungsi->formatUang($dtPsn['subtotal']); ?></td>
 			<td><?php echo $dtPsn['kota_tujuan'] ?></td>
 			<td><?php echo $objFungsi->formatUang($dtPsn['biaya_ongkir']); ?></td>
 			<td><?php echo $objFungsi->formatUang($dtPsn['biaya_ongkir']+$dtPsn['subtotal']); ?></td>
 			<td><a href="<?php echo BASEURLADMIN.'?v=transaksi&p=prosesorder&idorder='.$dtPsn['id_pemesanan'] ?>">Proses</a></td>
 		</tr>
 		<?php endforeach ?>
 	</table>
 </div>
 <?php endif ?>
  <h3>Daftar Stok Menipis:</h3>
 <hr />
 <?php if (count($mStok)==0): ?>
 	(tidak ada data)
 <?php else: ?>

 	<div class="frame_table_order">
<table width="100%" cellpadding="5" cellspacing="0" border="1" style="border-collapse:collapse">

    <thead>
        <tr align="center" valign="middle" bgcolor="#CCCCCC">
 			<td>Gambar</td>
 			<td>Nama</td>
 			<td>Kategori</td> 			
 			<td>Keterangan</td>
 			<td>Stok</td> 			
 		</tr>
 	</thead>
<?php foreach ($mStok as $minimStok): ?>
<tr>
 			<td><img style="height:50px;width:50px" src="<?php echo BASEURL.'produk/'.$minimStok['gambar'] ?>"></td>
 			<td><?php echo $minimStok['nama'] ?></td>
 			<td><?php echo $minimStok['nama_kategori'] ?></td> 			
 			<td><?php echo $objFungsi->readMore($minimStok['keterangan'],50); ?></td>
 			<td><?php echo $minimStok['jumlah'] ?></td> 			
 		</tr>	
<?php endforeach ?>
 </table> 
</div>
 <?php endif ?>